# coding=utf-8
import socket


def main():
    # 创建UDP套接字
    udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    while True:
        # 从键盘获取去数据
        send_data = input('清输入数据：\n')
        # 特殊指令退出
        if send_data == 'exit':
            break
        # 定义发送地址
        address = ("192.168.10.106", 8080)
        udp_socket.sendto(send_data.encode('utf-8'), address)
    # 关闭套接字
    udp_socket.close()


if __name__ == '__main__':
    main()
